#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
vector<int> findThePrefixCommonArray(vector<int>& A, vector<int>& B) {
    int n = A.size();
    vector<int> res(n);
    map<int,int> hash;
    for(int i = 0; i < n; ++i) {
        hash[A[i]]++;
        int pos = 0;
        for(int j = 0; j <= i; ++j) {
            if(hash[B[i]]) pos++;
        }
        res[i] = pos;
    }
    return res;
}